package com.ihd.ihardware.api;

import com.ihd.ihardware.pojo.ArticalRes;
import com.ihd.ihardware.pojo.BannerRes;
import com.ihd.ihardware.pojo.CollectRes;
import com.ihd.ihardware.pojo.CommentRes;
import com.ihd.ihardware.pojo.CommentsRes;
import com.ihd.ihardware.pojo.DeviceListRes;
import com.ihd.ihardware.pojo.EmptyRes;
import com.ihd.ihardware.pojo.FileRes;
import com.ihd.ihardware.pojo.HealthRecordRes;
import com.ihd.ihardware.pojo.LoginRes;
import com.ihd.ihardware.pojo.MembersRes;
import com.ihd.ihardware.pojo.MsgRes;
import com.ihd.ihardware.pojo.MsgsRes;
import com.ihd.ihardware.pojo.NormRes;
import com.ihd.ihardware.pojo.OtherUserInfoRes;
import com.ihd.ihardware.pojo.RecommendRes;
import com.ihd.ihardware.pojo.ReportRes;
import com.ihd.ihardware.pojo.ReportsRes;
import com.ihd.ihardware.pojo.SceneRes;
import com.ihd.ihardware.pojo.SignsRes;
import com.ihd.ihardware.pojo.UpdateRes;
import com.ihd.ihardware.pojo.UserInfoRes;
import com.ihd.ihardware.pojo.WeightRes;
import com.ihd.ihardware.pojo.WeightTrendsRes;
import com.ihd.ihardware.pojo.WeightsRes;

import cn.wowjoy.commonlibrary.utils.HttpUtils;
import io.reactivex.Flowable;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Streaming;
import retrofit2.http.Url;


public interface HttpClient {

    static HttpClient getService() {
        return HttpUtils.getInstance().getServer(HttpClient.class);
    }

    //注册
    @Headers("x-amazing-token:0")
    @POST("usercenter/api/v1/user/register")
    Flowable<LoginRes> regist(@Body RequestBody param);

    //发送短信验证码
    @Headers("x-amazing-token:0")
    @POST("datacenter/api/v1/sms/sendVerifySms")
    Flowable<EmptyRes> sendVerifySms(@Body RequestBody param);

    //登录
    @Headers("x-amazing-token:0")
    @POST("usercenter/api/v1/user/login")
    Flowable<LoginRes> login(@Body RequestBody param);

    //微信登录
    @Headers("x-amazing-token:0")
    @POST("usercenter/api/v1/user/login/wx")
    Flowable<LoginRes> wxLogin(@Body RequestBody param);

    //密码找回
    @Headers("x-amazing-token:0")
    @POST("usercenter/api/v1/user/resetPwd")
    Flowable<LoginRes> resetPwd(@Body RequestBody param);

    //保存/编辑用户基本信息
    @PUT("usercenter/api/v1/userData/info")
    Flowable<EmptyRes> userInfo(@Body RequestBody param);

    //获取当前用户基本信息
    @GET("usercenter/api/v1/userData/info")
    Flowable<UserInfoRes> getUserInfo();

    //用户设置目标
    @POST("datacenter/api/v1/physical/dream")
    Flowable<EmptyRes> dream(@Body RequestBody param);

    //获取推荐的用户列表
    @GET("usercenter/api/v1/discover/users/recommend")
    Flowable<RecommendRes> recommend();

    //查看所有关注用户的动态列表(分页)
    @GET("usercenter/api/v1/discover/concern/signs")
    Flowable<SignsRes> concernSigns(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize);

    //查看推荐动态列表(分页)
    @GET("usercenter/api/v1/discover/signs")
    Flowable<SignsRes> signs(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize);

    //根据场景查询不同文章列表
    //使用场景(1专家有话;2秘籍;3秘籍二)
    @GET("marketingcenter/api/v1/article/queryListScene")
    Flowable<SceneRes> queryListScene(@Query("scene") int scene);

    //查询通用文章列表
    @GET("marketingcenter/api/v1/article/queryList")
    Flowable<ArticalRes> queryList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Query("category") String category);

    //点赞
    @POST("marketingcenter/api/v1/userSign/tag")
    Flowable<EmptyRes> tag(@Body RequestBody param);

    //取消点赞
    @DELETE("marketingcenter/api/v1/userSign/tag/{signId}")
    Flowable<EmptyRes> delTag(@Path("signId") String signId);

    //关注
    @POST("usercenter/api/v1/userData/concern")
    Flowable<EmptyRes> concern(@Body RequestBody param);

    //取消关注
    @DELETE("usercenter/api/v1/userData/concern/{concernUserId}")
    Flowable<EmptyRes> delConcern(@Path("concernUserId") String concernUserId);

    //获取当前用户的关注列表
    @GET("usercenter/api/v1/userData/concernUsers")
    Flowable<RecommendRes> concernUsers();

    //文件上传到OSS
    @Multipart
    @POST("datacenter/api/v1/ossFile/uploadToOss")
    Flowable<FileRes> uploadToOss(@Part MultipartBody.Part param);

    //用户签到/打卡
    @POST("marketingcenter/api/v1/userSign/sign")
    Flowable<EmptyRes> sign(@Body RequestBody param);

    //获取当前用户打卡信息列表(分页)
    @GET("marketingcenter/api/v1/userSign/signs")
    Flowable<SignsRes> getSigns(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize);

    //动态评论列表（分页）
    @GET("marketingcenter/api/v1/userSign/sign/comments")
    Flowable<CommentsRes> getComments(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Query("signId") String signId);

    //提交评论
    @POST("marketingcenter/api/v1/userSign/comments")
    Flowable<EmptyRes> sendComment(@Body RequestBody param);

    //文章评论
    @POST("marketingcenter/api/v1/article/comment")
    Flowable<EmptyRes> sendArtComment(@Body RequestBody param);

    //根据不同条件查询通用文章评论列表
    @GET("marketingcenter/api/v1/articleComments/queryList")
    Flowable<CommentRes> articleCommentList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Query("articleId") String articleId);

    //文章收藏
    @POST("marketingcenter/api/v1/article/collect")
    Flowable<EmptyRes> artCollect(@Body RequestBody param);

    //文章收藏取消
    @DELETE("marketingcenter/api/v1/article/collectCancel/{id}")
    Flowable<EmptyRes> collectCancel(@Path("id") String id);

    //查询用户收藏文章列表
    @GET("marketingcenter/api/v1/articleCollect/collectArticle")
    Flowable<CollectRes> collectArticle();

    //查看其他用户信息
    @GET("usercenter/api/v1/discover/user/info")
    Flowable<OtherUserInfoRes> otherUserInfo(@Query("userId") String userId);

    //查看其他用户打卡信息列表(分页)
    @GET("usercenter/api/v1/discover/user/signs")
    Flowable<SignsRes> otherUserSigns(@Query("userId") String userId, @Query("pageNum") int pageNum, @Query("pageSize") int pageSize);

    //获取当前用户的粉丝列表
    @GET("usercenter/api/v1/userData/fans")
    Flowable<RecommendRes> fans();

    //获取当前用户未读消息列表
    @GET("usercenter/api/v1/userMessage/unReadMsgs")
    Flowable<MsgRes> unReadMsgs();

    //获取用户消息列表
    @GET("usercenter/api/v1/userMessage/msgs")
    Flowable<MsgsRes> msgs(@Query("msgType") String msgType);

    //获取用户家庭成员列表
    @GET("usercenter/api/v1/userFamily/members")
    Flowable<MembersRes> members();

    //添加家庭成员
    @POST("usercenter/api/v1/userFamily/member")
    Flowable<EmptyRes> addMember(@Body RequestBody param);

    //删除家庭成员
    @DELETE("usercenter/api/v1/userFamily/member/{memberId}")
    Flowable<EmptyRes> delMember(@Path("memberId") String memberId);

    //编辑家庭成员信息
    @PUT("usercenter/api/v1/userFamily/member")
    Flowable<EmptyRes> editMember(@Body RequestBody param);

    //设备信息列表查询
    @GET("datacenter/api/v1/equipment/queryList")
    Flowable<DeviceListRes> deviceList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize);

    //设备绑定
    @POST("datacenter/api/v1/equipment/bind")
    Flowable<EmptyRes> bind(@Body RequestBody param);

    //设备解绑
    @DELETE("datacenter/api/v1/equipment/unbind/{id}")
    Flowable<EmptyRes> unbind(@Path("id") String id);

    //测量用户或家庭成员体重
    @POST("datacenter/api/v1/physical/weighing")
    Flowable<EmptyRes> weighing(@Body RequestBody param);

    //查询用户或家庭成员身体报告
    @GET("datacenter/api/v1/physical/report")
    Flowable<ReportRes> report(@Query("familyId") String familyId);

    //查询用户或家庭成员体重数据
    @GET("datacenter/api/v1/physical/weight")
    Flowable<WeightRes> getWeight(@Query("familyId") String familyId);

    //查询用户或家庭成员体重趋势
    @GET("datacenter/api/v1/physical/weightTrends")
    Flowable<WeightTrendsRes> getWeightTrends(@Query("familyId") String familyId);

    //手动测量用户体重
    @POST("datacenter/api/v1/physical/handWeighing")
    Flowable<EmptyRes> handWeighing(@Body RequestBody param);

    //查询用户或家庭成员体重列表
    @GET("datacenter/api/v1/physical/weights")
    Flowable<WeightsRes> getWeights(@Query("familyId") String familyId, @Query("type") String type);

    //查询用户或家庭成员身体报告列表
    @GET("datacenter/api/v1/physical/reports")
    Flowable<ReportsRes> reports(@Query("familyId") String familyId, @Query("type") String type);

    //标准说明
    @GET("datacenter/api/v1/physical/norms/{id}")
    Flowable<NormRes> norms(@Path("id") String id);

    //查询用户健康档案
    @GET("datacenter/api/v1/healthRecord/details")
    Flowable<HealthRecordRes> healthRecord();

    //维护健康档案
    @POST("datacenter/api/v1/healthRecord/save")
    Flowable<EmptyRes> healthRecord(@Body RequestBody param);

    //更新
    @POST("appcenter/api/v1/version/getLatestVersion")
    Flowable<UpdateRes> getLatestVersion(@Body RequestBody param);

    @Streaming
    @GET
    Observable<ResponseBody> downloadapk(@Url String fileUrl);

    //删除体重信息
    @DELETE("datacenter/api/v1/physical/weighing/{id}")
    Flowable<EmptyRes> delWeighing(@Path("id") String id);

    //获取图片广告
    @Headers("x-amazing-token:0")
    @POST("appcenter/api/v1/banner/query")
    Flowable<BannerRes> getBanner(@Body RequestBody param);

    //推送注册
    @POST("appcenter/api/v1/equipment/registration")
    Flowable<EmptyRes> registration(@Body RequestBody param);

    //批量添加运动步数信息
    @POST("datacenter/api/v1/movement/batchStepNumber")
    Flowable<EmptyRes> batchStepNumber(@Body RequestBody param);

    //更新设备昵称
    @POST("datacenter/api/v1/equipment/update")
    Flowable<EmptyRes> update(@Body RequestBody param);

    //添加开锁记录信息
    @POST("datacenter/api/v1/lockRecord")
    Flowable<EmptyRes> addLockRecord(@Body RequestBody param);

    //查询开锁记录
    @GET("datacenter/api/v1/lockRecord/queryList")
    Flowable<DeviceListRes> lockRecordList(@Query("pageNum") int pageNum, @Query("pageSize") int pageSize, @Query("equipmentId") String equipmentId);
}